<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="__STATIC__/mobile/css/common.css" />
    <link rel="stylesheet" href="__STATIC__/mobile/css/about_us.css" />
    <link rel="stylesheet" href="__STATIC__/mobile/css/contact.css" />
    <link rel="stylesheet" href="__STATIC__/mobile/css/picker.css" />
    <link rel="stylesheet" href="__STATIC__/mobile/css/layer.css" />
    <title>{$pcate.name ?: '未名研学'}</title>
</head>

<body>
    <div class="about_us">
        <!--left navigation-->
        <div class="left_navigation">
            <ul>
                {foreach $catelist as $cv}
                {if $cv.id==$cur.id}
                <li class="on">
                    <a href="javascript:;">{$cv.name ?: ''}</a>
                </li>
                {else}
                {php}$cvid = $cv['id'];$pcid = $pcate['id'];$url = url("/item/$pcid-$cvid"){/php}
                <li>
                    <a href='javascript:location.replace("{$url}");'>{$cv.name ?: ''}</a>
                </li>
                {/if}
                {/foreach}


            </ul>
            <!--折叠按钮-->
            <div class="fold">
                <img src="__STATIC__/mobile/img/fold_show.png" alt="" id="show" />
                <img src="__STATIC__/mobile/img/fold.png" alt="" id="hide">
            </div>
        </div>
        <div class="about_box">
            <div class="consult contact">
                <div class="consult_type">
                    <div class="about_title">
                        <h6>加盟、合作联系方式</h6>
                        <img src="__STATIC__/mobile/img/icon-red-dotted.png" alt="" />
                    </div>
                    <!--联系方式-->
                    <div class="contact_type">
                        <ul>
                            {php}$list = json_decode(setting('list'),true);{/php}
                            {foreach $list as $l}
                            <li>
                                <img src="{$l.thumb ?: ''}" alt="" />
                                <span>{$l.name ?: ''}:</span>
                                <p>{$l.value ?: ''}</p>
                            </li>
                            {/foreach}
                        </ul>
                        <div class="contact_btn">
                            <a href="tel:{:setting('kefu_tel')}">
                                <button>立即咨询</button>
                            </a>
                        </div>
                    </div>
                </div>
                <!--在线留言-->
                <div class="leave_msg">
                    <div class="about_title">
                        <h6>在线留言</h6>
                        <img src="__STATIC__/mobile/img/icon-red-dotted.png" alt="" />
                    </div>
                    <form action="">
                        <ul class="leave_list">
                            <li>
                                <p>您的姓名</p>
                                <input type="text" placeholder="" id="userName" name="name"/>
                            </li>
                            <li>
                                <p>联系方式</p>
                                <input type="number" placeholder="" id="phone" name="tel"/>
                            </li>
                            <li>
                                <p>合作意向</p>
                                <label id="select">
                                    <input type="text" placeholder="" name="type" value="分校加盟" readonly onclick="$(this).blur()"/>
                                    <img src="__STATIC__/mobile/img/icon_down_arrow.png" alt="" />
                                </label>
                            </li>
                            <li>
                                <p>您的单位</p>
                                <input type="text" placeholder="" id="school" name="company"/>
                            </li>
                            <li>
                                <p>留言</p>
                                <textarea name="content" id=""></textarea>
                            </li>
                        </ul>
                        <div class="contact_btn" id="confirm">
                            <a href="javascript:;">
                                <button type="button">提交</button>
                            </a>
                        </div>
                    </form>
                </div>
            </div>
        </div>

    </div>

    <script src="__STATIC__/mobile/js/rem.js"></script>
    <script src="__STATIC__/mobile/js/jquery-3.3.1.min.js"></script>
    <script src="__STATIC__/mobile/js/picker.min.js"></script>
    <script src="__STATIC__/mobile/js/layer.js"></script>
    <script>
        $(function () {
            $('#show').on('click', function() {
                $('.left_navigation').addClass('hide')
                $('#hide').addClass('show')
            });
            $('#hide').on('click', function() {
                $('.left_navigation').removeClass('hide')
                $('#hide').removeClass('show')
            });
            $('.left_navigation ul li.on').on('click', function() {
                $('.about_box').stop(true).animate({
                    'scrollTop': 0
                })
            });

            var data1 = [{
                text: '分校加盟',
                value: 1
            }];
            var identifyEl = document.getElementById('select');
            var identify = new Picker({
                data: [data1]
            });
            identify.on('picker.select', function(selectedVal, selectedIndex) {
                $('#select').children('input').val(data1[selectedIndex[0]].text)
            });
            identifyEl.addEventListener('click', function() {
                identify.show()
            });
            //提交
            $('#confirm').on('click', function() {
                var name = $('[name="name"]').val();
                var tel = $('[name="tel"]').val();
                var type = $('[name="type"]').val();
                var company = $('[name="company"]').val();
                var content = $('[name="content"]').val();
                if ($('#userName').val() == '') {
                    layer.open({
                        content: "请输入您的姓名",
                        skin: "msg",
                        time: 2,
                    })
                    return false
                }
                if ($('#phone').val() == '') {
                    layer.open({
                        content: "请输入您的联系方式",
                        skin: "msg",
                        time: 2,
                    })
                    return false
                }
                if ($('#select').children('input').val() == '') {
                    layer.open({
                        content: "请选择合作意向",
                        skin: "msg",
                        time: 2,
                    })
                    return false
                }
                if ($('#school').val() == '') {
                    layer.open({
                        content: "请输入所在单位",
                        skin: "msg",
                        time: 2,
                    })
                    return false
                }
                $.ajax({
                    url:'{:url("/m/apply4")}',
                    type:'post',
                    data:{name:name,tel:tel,type:type,company:company,content:content},
                    success:function (res) {
                        if(res.code==1){
                            layer.open({
                                content: "提交成功",
                                skin: "msg",
                                time: 2,
                                end:function () {
                                    location.reload();
                                }
                            })
                        }else if(res.code=='busy'){
                            layer.open({
                                content: "您操作太频繁啦，稍后再来吧！",
                                skin: "msg",
                                time: 2,
                            })
                        }else {
                            layer.open({
                                content: "请输入正确信息",
                                skin: "msg",
                                time: 2,
                            })
                        }
                    }
                })
            })
        })

    </script>
</body>

</html>